package com.frxuexi.base

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions

object GlideUtils {
    fun rounderImg(url:String,iv:ImageView){
        Glide.with(iv).load(url)
            .apply(RequestOptions.bitmapTransform(RoundedCorners(20)))
            .into(iv)
    }

    fun circleImg(url:String?,iv:ImageView){
        if(!url.isNullOrEmpty()) {
            Glide.with(iv).load(url)
                .circleCrop()
                .placeholder(R.drawable.ic_action_author)
                .error(R.drawable.ic_action_author)
                .into(iv)
        }
    }

    fun rectImg(url:String,iv:ImageView){
        Glide.with(iv).load(url)
            .into(iv)
    }
}